package com.junsi.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.junsi.bean.ApproveTail;
import com.junsi.bean.CompactGenre;
import com.junsi.mapper.ApproveTailMapper;
import com.junsi.service.ApproveTailService;

@Service
@Transactional(rollbackFor = Exception.class)
public class ApproveTailServiceImpl implements ApproveTailService{
	@Autowired
	private ApproveTailMapper approveTailMapper;
	@Override
	public List<ApproveTail> listAll() {
		List<ApproveTail> list = approveTailMapper.listAll();
		return list;
	}

	@Override
	public ApproveTail findById(Integer id) {
		ApproveTail approveTail = approveTailMapper.findById(id);
		return approveTail;
	}

	@Override
	public boolean insert(ApproveTail o) throws Exception {

		int result = approveTailMapper.insert(o);
		if (result == 1) {
			return true;
		} else {
			return false;
		}

	}

	@Override
	public boolean update(ApproveTail o) throws Exception {
		int result = approveTailMapper.update(o);
		if (result == 1) {
			return true;
		} else {
			return false;
		}
	}

	@Override
	public boolean delete(Integer id) {
		int result = approveTailMapper.delete(id);
		if (result == 1) {
			return true;
		} else {
			return false;
		}

	}

	@Override
	public ApproveTail findapprove(String id) {
	  ApproveTail approveTail=approveTailMapper.findapprove(id);
		return approveTail;
	}

	@Override
	public boolean updateApproverID(ApproveTail approveTail) {
		int result = approveTailMapper.updateApproverID(approveTail);
		if (result == 1) {
			return true;
		} else {
			return false;
		}
	}

	@Override
	public boolean deleteApprove(Integer id) {
		int result = approveTailMapper.deleteApprove(id);
		if (result == 1) {
			return true;
		} else {
			return false;
		}
	}
}
